<template>
	<div class="myInviteCode">
		<v-Header :item="headerMess"></v-Header>
		<div class="inner">
			<img class="inner-img"  :src="imgurl" />
			
			<div class="box-img">
				<img src="../../assets/Invitation code.png"/>
			    <span class="myCodeq">{{code}}</span>
			    <p>邀请码</p>
			    <a>(该邀请码是您的专属)</a>
			</div>
		</div>
	</div>
</template>

<script>
	import my from '@/api/my/index'
	import { toast } from '@/util/index'
	import Header from '@/components/Header'
	export default{
		data(){
			return{
				code:'',
				headerMess:{
			        src:require("../../assets/nav_back.png"),
			        headerText: '我的邀请码',
			        right: ''
			    },
			    imgurl:"",
				
			}
		},
		components: {
		    "v-Header":Header,
		 },
		methods:{
			
		},
		beforeMount(){
			this.imgurl=require("../../assets/QR code_bg.png");
		},
		mounted(){
			let senddata = {
				userId:window.localStorage.getItem("token"),
				plat:"mlj"
			}
		
			my.myInviteCode(senddata).then((res) => {
				if (res.data.code == 200) {
					 if(res.data.data.code){
					 	this.code=res.data.data.code;
					 }
					
				}else if(res.data.code==222){
		            this.$router.push({path:'/login'})
		        } else {
					toast(data.data.message)
				}
			})
		},
		 beforeRouteEnter(to,from,next){
		    document.querySelector('title').innerText='谋略家'
		      next()
		  }
	}
</script>

<style lang="less" scoped>
@import '../../less/config.less';	
	.myInviteCode{
		width:100%;
		height:100%;
		display:flex;
		flex-direction: column;
		.header{
			padding:0 @p30;
			display: flex;
			justify-content:space-between;
			align-items: center;
			height:@hwrap;
			color:#fff;
			font-size:.48rem;
			img,.img{
				width: 30px;
				height: 30px;
			}
		}
		.inner{
			flex: 1;
			position: relative;
			overflow: hidden;
			width: 100%;
			display: block;
			
			.inner-img{
				display: block;
				margin: 0 auto;
				margin-top: 2*@fsize;
				width: 9.2rem;
			}
			.box-img{
				position: absolute;
				overflow: hidden;
				left: 50%;
				margin-left: -2rem;
				margin-top: -4.66rem;
				top: 50%;
				/*background: url(../../assets/Invitation code.png) no-repeat top center;*/
				width: 4.133rem;
				height: auto;
				display: flex;
				justify-content: center;
				align-items: center;
				flex-direction: column;
				img{
					display: block;
					width: 4.133rem;
					height: auto;
				}
				span{
				   height: 0.8533rem;
				   width: auto;
					margin-top: -3rem;
					font-size: .75rem;
					
				}
				p{
					margin-top: 2.6rem;
					color: white;
					font-size: .5rem;
					
				}
				a{
					/*margin-top: -.2rem;*/
					text-decoration: none;
				}
			}
		}
	}
	
	


</style>